Add polling to wait for post plan tasks to complete in remote backend#36655
Merged
Add polling to wait for post plan tasks to complete in remote backend#36655
Conversation
7c91cb2 to
02fd2a5
Compare
f1439cf to
746b083
Compare
brandonc
previously approved these changes
Mar 10, 2025
746b083 to
5eba132
Compare
5eba132 to
4ec7284
Compare
jbardin
approved these changes
Mar 12, 2025
Contributor
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Original Problem
It was seen that in some instances (Jira here) that using the remote backend with certain post plan tasks configured would cause the CLI to unceremoniously exit before confirmation could be given to apply runs in certain cases. This would occur due to these post plan tasks being in a running state when the backend checks if the run is confirmable.
To reproduce this behavior, set up a workspace (backed by a remote backend) with an OPA policy configured. When you perform an apply run, you'll see that the CLI exits before confirmation can be given (whether explicitly by the user or using auto-apply). Interestingly enough, I saw that enabling cost estimation avoided this erroneous behavior– since the processing of the cost estimate gave enough time for the OPA policy to complete before the confirmability of the run was checked.
Solution
Make the plan operation in the remote backend aware of post plan tasks, and have it wait for their completion before proceeding. The additions here are mostly copied from the analogous cloud backend methods, though I purposely omitted many of the features that you find in the cloud backend. The only text streamed to the console here would be notifications in the event of a task failing, or needing manual override– but the ability to do the override is not present here as it is in the cloud backend.
In total, when a post plan task errors, or otherwise doesn't pass, an error is shown:
Target Release
1.12.x
CHANGELOG entry
The remote backend now notifies the user if post plan tasks have failed and/or need manual override.